home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / stdiostream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-05  |  1.2 KB  |  63 lines  |  [TEXT/MPS ]

  1. /*
  2.     stdiostream.h -- Streams classes: stdiobuf, stdiostream
  3.  
  4.     Copyright Apple Computer,Inc.    1994-1995
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDIOSTREAM__
  10. #define __STDIOSTREAM__    1
  11.  
  12. #include <iostream.h>
  13. #include <stdio.h>
  14.  
  15. /*
  16.  * stdiobuf is obsolete, should be avoided!!!
  17.  */
  18. #ifdef powerc
  19. #pragma options align=power
  20. #endif
  21.  
  22. class stdiobuf : public streambuf
  23. {
  24.  
  25. public:
  26.                         stdiobuf(FILE* f);
  27.         FILE*           stdiofile()             { return fp; }
  28.         virtual         ~stdiobuf();
  29.  
  30. public:
  31.         virtual int     overflow(int = EOF);
  32.         virtual int     underflow();
  33.         virtual int     sync();
  34.         virtual streampos seekoff(streamoff, ios::seek_dir, int);
  35.         virtual int     pbackfail(int c);
  36.  
  37. private:
  38.         FILE*           fp;                     
  39.         int             last_op;
  40.         char            buf[2];
  41.  
  42. };  // class stdiobuf
  43.  
  44.  
  45. class stdiostream : public ios
  46. {
  47.  
  48. public:
  49.                         stdiostream(FILE*);
  50.                         ~stdiostream();
  51.         stdiobuf*       rdbuf();
  52.  
  53. private:
  54.         stdiobuf        buf;
  55.  
  56. };  // class stdiostream
  57.  
  58. #ifdef powerc
  59. #pragma options align=reset
  60. #endif
  61.  
  62. #endif    /* __STDIOSTREAM__ */
  63.